/**
 * Created by DevilsEyes on 2016/6/9.
 */
'use strict';

let {P, focus} = require('./Point');
let {Line} = require('./Line');

class Cube {
    constructor(d) {
        let a = d / 2;

        this.vertexs = [
            P(a, a, a),//0
            P(-a, a, a),//1
            P(a, -a, a),//2
            P(a, a, -a),//3
            P(-a, -a, a),//4
            P(-a, a, -a),//5
            P(a, -a, -a),//6
            P(-a, -a, -a)//7
        ]

    }

    get edges() {
        let vs = this.vertexs;
        return [
            [vs[0], vs[1]],
            [vs[0], vs[2]],
            [vs[0], vs[3]],

            [vs[1], vs[5]],
            [vs[1], vs[4]],

            [vs[2], vs[4]],
            [vs[2], vs[6]],

            [vs[3], vs[5]],
            [vs[3], vs[6]],

            [vs[7], vs[4]],
            [vs[7], vs[5]],
            [vs[7], vs[6]]
        ].map((L)=>new Line(L[0], L[1]))
    }
}

module.exports = {
    Cube
};